Skip to content

Conversation

@indygreg
Copy link
Collaborator

@indygreg indygreg commented Dec 31, 2024

This is a redo of #420, which was merged prematurely.

With the BOLT changes from #463 merged, LLVM 19 just works.

As part of this we also modernize the BOLT apply settings to follow the recommendations at https://llvm.org/devmtg/2024-03/slides/practical-use-of-bolt.pdf.

This includes enabling support for loading hot code from a huge page at runtime. This should just work and could result in perf wins via improved iTLB hit rate, etc.

@indygreg
Copy link
Collaborator Author

This is a redo of #420, which was merged prematurely.

The error we're seeing is:

BOLT-ERROR: unable to get new address corresponding to input address 0x3dd8f4 in function _PyEval_EvalFrameDefault. Consider adding this function to --skip-funcs=...

Looking at the LLVM source code, we see this error was introduced by llvm/llvm-project#89681, which first shipped in LLVM 19.1.0.

The added test case says BOLT can't handle computed gotos in position independent code (PIC) (we use PIC since we build with -fPIC). _PyEval_EvalFrameDefault uses computed gotos if they are available. So LLVM 19.1 just isn't capable of BOLT optimizing _PyEval_EvalFrameDefault.

We'll need to add _PyEval_EvalFrameDefault to the BOLT skip list.

@indygreg indygreg changed the base branch from main to gps/bolt-fixes January 1, 2025 19:38
@indygreg
Copy link
Collaborator Author

indygreg commented Jan 1, 2025

I diagnosed the BOLT issues and split those out into #463. I'm optimistic this will pass CI now.

@indygreg indygreg force-pushed the gps/llvm-19 branch 2 times, most recently from 4d7ae4e to 50273e8 Compare January 1, 2025 21:30
Base automatically changed from gps/bolt-fixes to main January 1, 2025 23:08
LLVM 19 yields a compile error without these patches.

Strictly speaking we may only need the final one. However there
are conflicts unless we take all patches to `src/aarch64/sysv.S`.
So we just take the 3 of them.
As part of this we also modernize the BOLT apply settings to follow
the recommendations at
https://llvm.org/devmtg/2024-03/slides/practical-use-of-bolt.pdf.

This includes enabling support for loading hot code from a huge page
at runtime. This should _just work_ and could result in perf wins via
improved iTLB hit rate, etc.
@indygreg indygreg marked this pull request as ready for review January 1, 2025 23:12
@indygreg indygreg requested a review from zanieb January 2, 2025 02:36
@zanieb zanieb merged commit 0be0a57 into main Jan 2, 2025
308 checks passed
@zanieb zanieb deleted the gps/llvm-19 branch January 2, 2025 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants